package com.webflux.routes;

import com.webflux.ContextPath;
import com.webflux.handlers.ProductHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

@Configuration
public class BaseRoute {



    @Bean
    public RouterFunction<ServerResponse> routerFunction(ProductHandler handler){

        return RouterFunctions.route()
                .GET(ContextPath.findbyId,handler::findById)
                .build();



    }
}
